//
//  YRJCityGoFreedomCollectionViewCell.m
//  YanRenjie
//
//  Created by dllo on 15/10/30.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJCityGoFreedomCollectionViewCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation YRJCityGoFreedomCollectionViewCell
- (void)dealloc {
    [_photoImageView release];
    [_titleLabel release];
    [_priceLabel release];
    [_priceoffLabel release];
    
    [super dealloc];
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell {
    self.photoImageView = [[UIImageView alloc] init];
    [self addSubview:self.photoImageView];
    [_photoImageView release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self addSubview:self.titleLabel];
    [_titleLabel release];
    self.titleLabel.font = [UIFont systemFontOfSize:12];
    self.titleLabel.numberOfLines = 2;
    self.titleLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.7];
    
    self.priceoffLabel = [[UILabel alloc] init];
    [self addSubview:self.priceoffLabel];
    [_priceoffLabel release];
    self.priceoffLabel.font = [UIFont systemFontOfSize:8];
    self.priceoffLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.7];
    
    self.priceLabel = [[UILabel alloc] init];
    [self addSubview:self.priceLabel];
    [_priceLabel release];
    self.priceLabel.font = [UIFont systemFontOfSize:10];
    self.priceLabel.backgroundColor = [UIColor colorWithRed:220 / 255.0 green:220 / 255.0 blue:220 / 255.0 alpha:0.7];
}

- (void)layoutSubviews {
//    [super layoutSubviews];
//    self.photoImageView.frame = CGRectMake(0, 0, WIDTH, (200.0 / 260) * HEIGHT);
//    self.titleLabel.frame = CGRectMake(0, (200.0 / 260.0) * HEIGHT, WIDTH, (30.0 / 260.0) * HEIGHT);
//    self.priceoffLabel.frame = CGRectMake(0, (230.0 / 260.0) * HEIGHT, (80.0 / 160.0) * WIDTH, (15.0 / 260.0) * HEIGHT);
//    self.priceLabel.frame = CGRectMake((80.0 / 160.0) * WIDTH, (230.0 / 260.0) * HEIGHT, (80.0 / 160.0) * WIDTH, (15.0 / 260.0) * HEIGHT);
//    NSLog(@"%f", WIDTH);
//    NSLog(@"%f", HEIGHT);
    
    [super layoutSubviews];
    self.photoImageView.frame = CGRectMake(0, 0, WIDTH, (200.0 / 260) * HEIGHT);
    self.titleLabel.frame = CGRectMake(0, (200.0 / 260.0) * HEIGHT, WIDTH, (30.0 / 260.0) * HEIGHT);
    self.priceoffLabel.frame = CGRectMake(0, (230.0 / 260.0) * HEIGHT, (80.0 / 160.0) * WIDTH, (15.0 / 260.0) * HEIGHT);
    self.priceLabel.frame = CGRectMake((80.0 / 160.0) * WIDTH, (230.0 / 260.0) * HEIGHT, (80.0 / 160.0) * WIDTH, (15.0 / 260.0) * HEIGHT);
    NSLog(@"%f", WIDTH);
    NSLog(@"%f", HEIGHT);
}


@end
